Skip to content

Conversation

@hcirellu
Copy link
Collaborator

The default S3 dispatch on the Ops group for two arguments having class attributes results in a dispatch of the default method with a warning. Since R 4.3.0 one can use chooseOpsMethod to handle that situation by signaling which method of the two classes should be dispatched to.

Since difftime * integer64 or integer64 * difftime should return difftime I use the helper target_class_for_Ops() to determine whether to return integer64 or not. Everytime when a integer64 argument is paired with a logical, (plain) integer, integer64, or (plain) double argument integer64 is returned. Otherwise the integer64 argument is coerced to double and the method of the class of the other argument (or default) is called.

I moved all the methods of the Ops group into a new file ops64.R with a corresponding man page.

I figured out, that an explicit handling of xor is not necessary, since the default functions (either base or bit) work and have a consistent result with base R.

I added tests for a consistent behaviour of R for the data types logical, integer, double, complex, Date, POSIXct, POSIXlt, and difftime for all Ops operators including xor.

(During testing I found #248.)

Closes #179

@hcirellu hcirellu marked this pull request as ready for review January 19, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for <int64> * <difftime>

3 participants